@extends('backend::layout')

@section('title', '历史版本')

@section('content')
    <div class="card border-no">
        <div class="card-body">
            @if($currentAdmin->allow('version/add'))
            <div class="row">
                <div class="clearfix"></div>
                <div class="col-md-12 col-sm-12 col-xs-12 pull-right">
                    <p>
                        <a href="{{ route('admin.version.add') }}" class="btn btn-primary btn-sm">新增版本</a>
                    </p>
                </div>
            </div>
            @endif
            <h4 class="text-black f-20">版本列表</h4>
            <div class="table-responsive">
                <table class="table table-hover">
                    <thead>
                    <tr>
                        <th scope="col">#</th>
                        <th scope="col">{{ __('Version') }}</th>
                        <th scope="col">文件</th>
                        <!--<th scope="col">{{ __('Download_num') }}</th>-->
                        <th scope="col">是否强制更新</th>
                        <th scope="col">整包/分包</th>
                        <th scope="col">{{ __('Create Time') }}</th>
                        <th scope="col">{{ __('Options') }}</th>

                    </tr>
                    </thead>
                    <tbody>
                    @if(isset($list))
                        @foreach($list as $idx => $item)
                            <tr>
                                <th scope="row">{{ $idx + 1 }}</th>
                                <td>{{ $item->version }}</td>

                                <td>
                                    @if($item->file)
                                    <a href="{{ \App\Models\File::getFileUrl($item->hash) }}">{{$item->file->title}}</a>
                                    @endif
                                </td>
                                <!--<td>{{ $item->download_num }}</td>-->
                                <td>{{ $item->is_force == 1 ? "强制" : "" }}</td>
                                <td>{{ $item->is_whole == 1 ? "整包" : "分包" }}</td>
                                <td>{{ $item->created_at }}</td>
                                <td>
                                    @if($currentAdmin->allow('version/view'))
                                        <a href="{{ route('admin.version.view', ['id' => $item->id]) }}" class="text-primary" title="{{ __('View') }}"><i class="fa fa-eye"></i></a>
                                    @endif

                                    @if($currentAdmin->allow('version/delete'))
                                        <a href="{{ route('admin.version.delete', ['id' => $item->id]) }}" class="text-danger confirm-delete" title="{{ __('Delete') }}">&nbsp;&nbsp;<i class="fa fa-trash-o"></i></a>
                                    @endif
                                </td>
                            </tr>
                        @endforeach
                    @endif
                    </tbody>
                </table>
            </div>
            <div class="row">
                <div class="clearfix"></div>
                <div class="col-md-12 col-sm-12 col-xs-12 pull-right">
                    @if(isset($list))
                        {{ $list->links() }}
                    @endif
                </div>
            </div>
        </div>
    </div>
@stop